package com.itheima.stock.controller;

import com.itheima.stock.mapper.SysUserMapper;
import com.itheima.stock.pojo.entity.SysUser;
import com.itheima.stock.service.ISysUserService;
import com.itheima.stock.vo.res.LoginReqVo;
import com.itheima.stock.vo.resp.LoginRespVo;
import com.itheima.stock.vo.resp.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * 用户相关接口
 */
@RequestMapping("/api")
@RestController
@Slf4j
public class UserController {
   @Resource
   private ISysUserService userService;

   /**
    * 用户登录
    * @param loginReqVo
    * @return
    */
   @PostMapping("login")
   public R<LoginRespVo> login(@RequestBody LoginReqVo loginReqVo){
       return userService.login(loginReqVo);
   }

   /**
    * 获取验证码
    * @return
    */
   @GetMapping("captcha")
   public R<Map<String, String>> getCaptchaCode(){
       return userService.getCaptchaCode();
   }

}
